<?php
mysql_connect("127.0.0.1","root","sd2013");
mysql_select_db("mathRomp");

//Get array of completed assignments

$q=mysql_query("SELECT t.name, a.numProblems, a.problems, a.assignmentId, a.currentProbNum, a.templates FROM `Teachers` AS t JOIN `Assignment` AS a JOIN `Assignment-Teacher` AS at ON a.userId = '".$_REQUEST['userId']."' AND at.assignmentId = a.assignmentId AND t.teacherId = at.teacherId AND a.NumProblems=a.currentProbNum");

while($g=mysql_fetch_assoc($q)){
  $output[]=$g;
}
print(json_encode($output));

?>